/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vista.patologias;

import java.awt.Color;
import java.awt.Component;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeSelectionModel;
import org.japura.gui.CheckList;
import org.japura.gui.model.DefaultListCheckModel;
import util.GestorComponenteVista;
import util.components.CamelCaseTextField;
import util.validation.annotation.Filter;
import util.validation.annotation.NotEmpty;


//Todo este quilombo nada mas para agregar un puntito de mierda


/**
 *
 * @author raul
 */
public class PatologiasPnl extends javax.swing.JPanel {

    private String nombrePanel="Patologias";
    private GestorVistaPatologiasPnl gestorVista;
    private GestorVistaEditorPatologia gestorEdicion;

    /**
     * Creates new form PatologiasPnl
     */
    public PatologiasPnl() {
        initComponents();
    }

    public PatologiasPnl(GestorVistaPatologiasPnl gestorVista) {
        this();
        this.gestorVista = gestorVista;
    }

    public GestorVistaPatologiasPnl getGestorVista() {
        return gestorVista;
    }

    public void setGestorVista(GestorVistaPatologiasPnl gestorVista) {
        this.gestorVista = gestorVista;
    }

    public GestorVistaEditorPatologia getGestorEdicion() {
        return gestorEdicion;
    }

    public void setGestorEdicion(GestorVistaEditorPatologia gestorEdicion) {
        this.gestorEdicion = gestorEdicion;
    }

    public JTextArea getDescripcionDeEnfermedadTxt() {
        return descripcionDeEnfermedadTxt;
    }

    public JTextArea getDescripcionDeTipoDeEnfermedadTxt() {
        return descripcionDeTipoDeEnfermedadTxt;
    }

    @NotEmpty
    public CamelCaseTextField getNombreEnfermedadTxt() {
        return nombreEnfermedadTxt;
    }

    @NotEmpty(mensaje = "Debe indicar algun síntoma para la enfermedad")
    public JList getSintomasLst() {
        return sintomasLst;
    }

    @NotEmpty
    public JComboBox getTipoDeEnfermedadCmb() {
        return tipoDeEnfermedadCmb;
    }

    public JDialog getEditorSintomasDlg() {
        return editorSintomasDlg;
    }

    public JDialog getEditorTiposEnfermedadDlg() {
        return editorTiposEnfermedadDlg;
    }

    @Filter
    public JTextField getNombreTxt() {
        return nombreTxt;
    }

    @Filter
    public JList getSintomasBusqLst() {
        return sintomasBusqLst;
    }

    @Filter
    public JComboBox getTipoEnfermedadBusqCmb() {
        return tipoEnfermedadBusqCmb;
    }

    public JCheckBox getLigadaAlSexoChk() {
        return ligadaAlSexoChk;
    }

    public CheckList getParentescosTransmisoresCkl() {
        return parentescosTransmisoresCkl;
    }
    
    void crearModeloArbol(TreeModel model, ImageIcon leafIcon) {
        GestorComponenteVista.crearModeloArbol(enfermedadesTree, model, leafIcon);
    }

    void agregarNodoArbol(Object padre, Object hijo) {
        GestorComponenteVista.agregarNodoArbol(enfermedadesTree, padre, hijo);
    }

    void cargarListaSintomas(Collection sintomas) {
        GestorComponenteVista.cargarLista(sintomasLst, sintomas);
    }
    
    void cargarComboTipoEnfermedad(List tiposEnfermedad) {
        GestorComponenteVista.cargarCombo(tipoDeEnfermedadCmb, tiposEnfermedad);
    }
    
    void cargarComboTipoEnfermedadBusq(List tiposEnfermedad) {
        GestorComponenteVista.cargarCombo(tipoEnfermedadBusqCmb, tiposEnfermedad);
    }
    
    void limpiarPantalla() {
        nombreEnfermedadTxt.setText("");
        descripcionDeEnfermedadTxt.setText("");
        tipoDeEnfermedadCmb.setSelectedIndex(0);
        descripcionDeTipoDeEnfermedadTxt.setText("");
        cargarListaSintomas(new ArrayList());
        ligadaAlSexoChk.setSelected(false);
        setearParentescosTransmisores(new ArrayList());
    }
    
    void habilitarEdicion(boolean b){
        nombreEnfermedadTxt.setEditable(b);
        descripcionDeEnfermedadTxt.setEditable(b);
        tipoDeEnfermedadCmb.setEnabled(b);
        crearSintomaBtn.setEnabled(b);
        crearTipoEnfermedadBtn.setEnabled(b);
        addSintomaBtn.setEnabled(b);
        quitarSintomaBtn.setEnabled(b);
        guardarBtn.setEnabled(b);
        cancelarBtn.setEnabled(b);
        enfermedadesTree.setEnabled(!b);
        eliminarBtn.setEnabled(!b);
        buscarTxt.setEnabled(!b);
        buscarBtn.setEnabled(!b);
        abrirFormularioBusquedaAvanzadaBtn.setEnabled(!b);
        ligadaAlSexoChk.setEnabled(b);
        parentescosTransmisoresCkl.setEnabled(b);
    }
    
    void cargarCheckListSintomas(Collection sintomas){
        GestorComponenteVista.cargarLista(sintomasCkl, sintomas);
    }
    
    void cargarCheckListParentescos(Collection parentescos){
        GestorComponenteVista.cargarLista(parentescosTransmisoresCkl, parentescos);
    }
    
    void setearParentescosTransmisores(Collection parentescosTransmisores) {
        GestorComponenteVista.setearSeleccionadosCheckList(parentescosTransmisoresCkl, parentescosTransmisores);
    }

    void quitarNodo(Object oldModelo) {
        GestorComponenteVista.quitarNodoArbol(enfermedadesTree, oldModelo);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PatologiasPnl other = (PatologiasPnl) obj;
        if ((this.nombrePanel == null) ? (other.nombrePanel != null) : !this.nombrePanel.equals(other.nombrePanel)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 19 * hash + (this.nombrePanel != null ? this.nombrePanel.hashCode() : 0);
        return hash;
    }


    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        selectorSintomasDlg = new javax.swing.JDialog();
        jPanel4 = new javax.swing.JPanel();
        acceptBtn = new javax.swing.JButton();
        declineBtn = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        sintomasCkl = new org.japura.gui.CheckList();
        editorSintomasDlg = new javax.swing.JDialog();
        editorSintomasPnl = new vista.patologias.SintomasPnl();
        cancelarEdicionSintomaBtn = new javax.swing.JButton();
        guardarSintomaBtn = new javax.swing.JButton();
        editorTiposEnfermedadDlg = new javax.swing.JDialog();
        guardarTipoEnfermedad = new javax.swing.JButton();
        cancelarEdicionTipoEnfermedadBtn = new javax.swing.JButton();
        editorTipoEnfermedadPnl = new vista.patologias.TipoEnfermedadPnl();
        busquedaAvanzadaDlg = new javax.swing.JDialog();
        jLabel5 = new javax.swing.JLabel();
        nombreTxt = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        tipoEnfermedadBusqCmb = new javax.swing.JComboBox();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        sintomasBusqLst = new javax.swing.JList();
        jToolBar1 = new javax.swing.JToolBar();
        addSintomaBtn1 = new javax.swing.JButton();
        quitarSintomaBtn1 = new javax.swing.JButton();
        cancelarBusquedaBtn = new javax.swing.JButton();
        busquedaAvanzadaBtn = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        enfermedadesTree = new javax.swing.JTree();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        descripcionDeEnfermedadTxt = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        nombreEnfermedadTxt = new util.components.CamelCaseTextField();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        descripcionDeTipoDeEnfermedadTxt = new javax.swing.JTextArea();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        tipoDeEnfermedadCmb = new javax.swing.JComboBox();
        crearTipoEnfermedadBtn = new javax.swing.JButton();
        nuevaEnfermedadBtn = new javax.swing.JButton();
        cancelarBtn = new javax.swing.JButton();
        guardarBtn = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        sintomasLst = new javax.swing.JList();
        addSintomaBtn = new javax.swing.JButton();
        quitarSintomaBtn = new javax.swing.JButton();
        crearSintomaBtn = new javax.swing.JButton();
        modificarBtn = new javax.swing.JButton();
        eliminarBtn = new javax.swing.JButton();
        buscarTxt = new javax.swing.JTextField();
        buscarBtn = new javax.swing.JButton();
        imprimirBtn = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        listarTodosBtn = new javax.swing.JButton();
        abrirFormularioBusquedaAvanzadaBtn = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        ligadaAlSexoChk = new javax.swing.JCheckBox();
        jScrollPane7 = new javax.swing.JScrollPane();
        parentescosTransmisoresCkl = new org.japura.gui.CheckList();

        selectorSintomasDlg.setTitle("Sintomas");
        selectorSintomasDlg.setBackground(java.awt.Color.white);
        selectorSintomasDlg.setModal(true);
        selectorSintomasDlg.setUndecorated(true);

        jPanel4.setBorder(new util.components.RoundedBorder());

        acceptBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/accept.png"))); // NOI18N
        acceptBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                acceptBtnActionPerformed(evt);
            }
        });

        declineBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/delete_24.png"))); // NOI18N
        declineBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                declineBtnActionPerformed(evt);
            }
        });

        sintomasCkl.setLayoutOrientation(javax.swing.JList.VERTICAL_WRAP);
        jScrollPane5.setViewportView(sintomasCkl);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane5)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(0, 702, Short.MAX_VALUE)
                        .addComponent(acceptBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(declineBtn)))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(declineBtn)
                    .addComponent(acceptBtn))
                .addGap(6, 6, 6))
        );

        javax.swing.GroupLayout selectorSintomasDlgLayout = new javax.swing.GroupLayout(selectorSintomasDlg.getContentPane());
        selectorSintomasDlg.getContentPane().setLayout(selectorSintomasDlgLayout);
        selectorSintomasDlgLayout.setHorizontalGroup(
            selectorSintomasDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        selectorSintomasDlgLayout.setVerticalGroup(
            selectorSintomasDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        selectorSintomasDlg.pack();
        GestorComponenteVista.centrarVentana(selectorSintomasDlg);

        editorSintomasDlg.setTitle("Editar Síntoma");
        editorSintomasDlg.setMinimumSize(new java.awt.Dimension(400, 175));
        editorSintomasDlg.setModal(true);
        editorSintomasDlg.setResizable(false);
        editorSintomasDlg.setLocationRelativeTo(null);

        cancelarEdicionSintomaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cancel.png"))); // NOI18N
        cancelarEdicionSintomaBtn.setText("cancelar");
        cancelarEdicionSintomaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarEdicionSintomaBtnActionPerformed(evt);
            }
        });

        guardarSintomaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/disk.png"))); // NOI18N
        guardarSintomaBtn.setText("guardar");
        guardarSintomaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarSintomaBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout editorSintomasDlgLayout = new javax.swing.GroupLayout(editorSintomasDlg.getContentPane());
        editorSintomasDlg.getContentPane().setLayout(editorSintomasDlgLayout);
        editorSintomasDlgLayout.setHorizontalGroup(
            editorSintomasDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorSintomasDlgLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(guardarSintomaBtn)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cancelarEdicionSintomaBtn)
                .addContainerGap())
            .addComponent(editorSintomasPnl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        editorSintomasDlgLayout.setVerticalGroup(
            editorSintomasDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorSintomasDlgLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cancelarEdicionSintomaBtn)
                .addGap(12, 12, 12))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorSintomasDlgLayout.createSequentialGroup()
                .addComponent(editorSintomasPnl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(guardarSintomaBtn)
                .addContainerGap())
        );

        editorTiposEnfermedadDlg.setTitle("Editar Tipo de Enfermedad");
        editorTiposEnfermedadDlg.setMinimumSize(new java.awt.Dimension(400, 278));
        editorTiposEnfermedadDlg.setModal(true);
        editorTiposEnfermedadDlg.setResizable(false);
        editorTiposEnfermedadDlg.setLocationRelativeTo(null);

        guardarTipoEnfermedad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/disk.png"))); // NOI18N
        guardarTipoEnfermedad.setText("Guardar");
        guardarTipoEnfermedad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarTipoEnfermedadActionPerformed(evt);
            }
        });

        cancelarEdicionTipoEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cancel.png"))); // NOI18N
        cancelarEdicionTipoEnfermedadBtn.setText("Cancelar");
        cancelarEdicionTipoEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarEdicionTipoEnfermedadBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout editorTiposEnfermedadDlgLayout = new javax.swing.GroupLayout(editorTiposEnfermedadDlg.getContentPane());
        editorTiposEnfermedadDlg.getContentPane().setLayout(editorTiposEnfermedadDlgLayout);
        editorTiposEnfermedadDlgLayout.setHorizontalGroup(
            editorTiposEnfermedadDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorTiposEnfermedadDlgLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(guardarTipoEnfermedad)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cancelarEdicionTipoEnfermedadBtn)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorTiposEnfermedadDlgLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(editorTipoEnfermedadPnl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        editorTiposEnfermedadDlgLayout.setVerticalGroup(
            editorTiposEnfermedadDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, editorTiposEnfermedadDlgLayout.createSequentialGroup()
                .addComponent(editorTipoEnfermedadPnl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(editorTiposEnfermedadDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelarEdicionTipoEnfermedadBtn)
                    .addComponent(guardarTipoEnfermedad))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        busquedaAvanzadaDlg.setTitle("Busqueda Avanzada");
        busquedaAvanzadaDlg.setMinimumSize(new java.awt.Dimension(505, 375));
        busquedaAvanzadaDlg.setModal(true);

        jLabel5.setText("Nombre");

        jLabel6.setText("Tipo Enfermedad");

        tipoEnfermedadBusqCmb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Síntomas"));
        jPanel5.setMaximumSize(new java.awt.Dimension(482, 168));
        jPanel5.setLayout(new java.awt.GridBagLayout());

        sintomasBusqLst.setModel(new DefaultListModel());
        sintomasBusqLst.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        sintomasBusqLst.setLayoutOrientation(javax.swing.JList.VERTICAL_WRAP);
        sintomasBusqLst.setMaximumSize(new java.awt.Dimension(100, 50));
        sintomasBusqLst.setVisibleRowCount(3);
        jScrollPane6.setViewportView(sintomasBusqLst);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 447;
        gridBagConstraints.ipady = 84;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        jPanel5.add(jScrollPane6, gridBagConstraints);

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setMaximumSize(new java.awt.Dimension(74, 38));
        jToolBar1.setOpaque(false);

        addSintomaBtn1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowDown_24.png"))); // NOI18N
        addSintomaBtn1.setToolTipText("Agregar síntoma");
        addSintomaBtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addSintomaBtn1ActionPerformed(evt);
            }
        });
        jToolBar1.add(addSintomaBtn1);

        quitarSintomaBtn1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowUp_24.png"))); // NOI18N
        quitarSintomaBtn1.setToolTipText("Quitar síntoma");
        quitarSintomaBtn1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitarSintomaBtn1ActionPerformed(evt);
            }
        });
        jToolBar1.add(quitarSintomaBtn1);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 395;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        jPanel5.add(jToolBar1, gridBagConstraints);

        cancelarBusquedaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/delete.png"))); // NOI18N
        cancelarBusquedaBtn.setText("Cancelar");
        cancelarBusquedaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarBusquedaBtnActionPerformed(evt);
            }
        });

        busquedaAvanzadaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/find.png"))); // NOI18N
        busquedaAvanzadaBtn.setText("Buscar");
        busquedaAvanzadaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                busquedaAvanzadaBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout busquedaAvanzadaDlgLayout = new javax.swing.GroupLayout(busquedaAvanzadaDlg.getContentPane());
        busquedaAvanzadaDlg.getContentPane().setLayout(busquedaAvanzadaDlgLayout);
        busquedaAvanzadaDlgLayout.setHorizontalGroup(
            busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(busquedaAvanzadaDlgLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(busquedaAvanzadaDlgLayout.createSequentialGroup()
                        .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6))
                        .addGap(18, 18, 18)
                        .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nombreTxt)
                            .addComponent(tipoEnfermedadBusqCmb, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, busquedaAvanzadaDlgLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(busquedaAvanzadaBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cancelarBusquedaBtn)))
                .addContainerGap())
        );
        busquedaAvanzadaDlgLayout.setVerticalGroup(
            busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(busquedaAvanzadaDlgLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(nombreTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(tipoEnfermedadBusqCmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(busquedaAvanzadaDlgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cancelarBusquedaBtn)
                    .addComponent(busquedaAvanzadaBtn))
                .addContainerGap())
        );

        enfermedadesTree.setRootVisible(false);
        enfermedadesTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                enfermedadesTreeValueChanged(evt);
            }
        });
        enfermedadesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
        jScrollPane1.setViewportView(enfermedadesTree);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Enfermedad"));

        descripcionDeEnfermedadTxt.setColumns(20);
        descripcionDeEnfermedadTxt.setEditable(false);
        descripcionDeEnfermedadTxt.setLineWrap(true);
        descripcionDeEnfermedadTxt.setRows(3);
        jScrollPane2.setViewportView(descripcionDeEnfermedadTxt);

        jLabel1.setText("Nombre");

        jLabel2.setText("Descripción");

        nombreEnfermedadTxt.setEditable(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(7, 7, 7)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(nombreEnfermedadTxt, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 609, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(nombreEnfermedadTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane2))
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Tipo de Enfermedad"));

        descripcionDeTipoDeEnfermedadTxt.setColumns(20);
        descripcionDeTipoDeEnfermedadTxt.setEditable(false);
        descripcionDeTipoDeEnfermedadTxt.setLineWrap(true);
        descripcionDeTipoDeEnfermedadTxt.setRows(3);
        jScrollPane3.setViewportView(descripcionDeTipoDeEnfermedadTxt);

        jLabel3.setText("Nombre");

        jLabel4.setText("Descripción");

        tipoDeEnfermedadCmb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        tipoDeEnfermedadCmb.setEnabled(false);
        tipoDeEnfermedadCmb.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tipoDeEnfermedadCmbActionPerformed(evt);
            }
        });

        crearTipoEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/add_24.png"))); // NOI18N
        crearTipoEnfermedadBtn.setToolTipText("Registrar un nuevo tipo");
        crearTipoEnfermedadBtn.setBorderPainted(false);
        crearTipoEnfermedadBtn.setEnabled(false);
        crearTipoEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                crearTipoEnfermedadBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addGap(7, 7, 7)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(tipoDeEnfermedadCmb, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(crearTipoEnfermedadBtn)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(tipoDeEnfermedadCmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(crearTipoEnfermedadBtn)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        nuevaEnfermedadBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/add.png"))); // NOI18N
        nuevaEnfermedadBtn.setText("Nuevo");
        nuevaEnfermedadBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nuevaEnfermedadBtnActionPerformed(evt);
            }
        });

        cancelarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/cancel.png"))); // NOI18N
        cancelarBtn.setText("Cancelar");
        cancelarBtn.setEnabled(false);
        cancelarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarBtnActionPerformed(evt);
            }
        });

        guardarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/disk.png"))); // NOI18N
        guardarBtn.setText("Guardar");
        guardarBtn.setEnabled(false);
        guardarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarBtnActionPerformed(evt);
            }
        });

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Síntomas"));

        sintomasLst.setModel(new DefaultListModel());
        sintomasLst.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        sintomasLst.setCellRenderer(new MyListCellRenderer());
        sintomasLst.setLayoutOrientation(javax.swing.JList.VERTICAL_WRAP);
        sintomasLst.setVisibleRowCount(4);
        jScrollPane4.setViewportView(sintomasLst);

        addSintomaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowDown_24.png"))); // NOI18N
        addSintomaBtn.setToolTipText("Agregar síntoma");
        addSintomaBtn.setBorderPainted(false);
        addSintomaBtn.setEnabled(false);
        addSintomaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addSintomaBtnActionPerformed(evt);
            }
        });

        quitarSintomaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/ArrowUp_24.png"))); // NOI18N
        quitarSintomaBtn.setToolTipText("Quitar síntoma");
        quitarSintomaBtn.setBorderPainted(false);
        quitarSintomaBtn.setEnabled(false);
        quitarSintomaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitarSintomaBtnActionPerformed(evt);
            }
        });

        crearSintomaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/add_24.png"))); // NOI18N
        crearSintomaBtn.setToolTipText("Registrar un nuevo síntoma");
        crearSintomaBtn.setBorderPainted(false);
        crearSintomaBtn.setEnabled(false);
        crearSintomaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                crearSintomaBtnActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(crearSintomaBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 171, Short.MAX_VALUE)
                        .addComponent(addSintomaBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(quitarSintomaBtn)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(addSintomaBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(quitarSintomaBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(crearSintomaBtn, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4)
                .addContainerGap())
        );

        modificarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/pencil.png"))); // NOI18N
        modificarBtn.setText("Modificar");
        modificarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                modificarBtnActionPerformed(evt);
            }
        });

        eliminarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/delete.png"))); // NOI18N
        eliminarBtn.setText("Eliminar");
        eliminarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eliminarBtnActionPerformed(evt);
            }
        });

        buscarTxt.setToolTipText("Buscar enfermedad");
        buscarTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buscarBtnActionPerformed(evt);
            }
        });

        buscarBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/zoom.png"))); // NOI18N
        buscarBtn.setToolTipText("Buscar Enfermedad");
        buscarBtn.setBorderPainted(false);
        buscarBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buscarBtnActionPerformed(evt);
            }
        });

        imprimirBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/printer.png"))); // NOI18N
        imprimirBtn.setText("Imprimir");
        imprimirBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imprimirBtnActionPerformed(evt);
            }
        });

        listarTodosBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/prescription_16.png"))); // NOI18N
        listarTodosBtn.setText("Listar todas");
        listarTodosBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                listarTodosBtnActionPerformed(evt);
            }
        });

        abrirFormularioBusquedaAvanzadaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/find.png"))); // NOI18N
        abrirFormularioBusquedaAvanzadaBtn.setToolTipText("Busqueda avanzada");
        abrirFormularioBusquedaAvanzadaBtn.setBorderPainted(false);
        abrirFormularioBusquedaAvanzadaBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                abrirFormularioBusquedaAvanzadaBtnActionPerformed(evt);
            }
        });

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Transmisión"));

        ligadaAlSexoChk.setText("Ligada Al Sexo");
        ligadaAlSexoChk.setEnabled(false);

        jScrollPane7.setBorder(javax.swing.BorderFactory.createTitledBorder("Parentescos Transmisores"));

        parentescosTransmisoresCkl.setEnabled(false);
        jScrollPane7.setViewportView(parentescosTransmisoresCkl);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(ligadaAlSexoChk)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jScrollPane7))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ligadaAlSexoChk)
                .addGap(11, 11, 11)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(nuevaEnfermedadBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(modificarBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(eliminarBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(buscarTxt)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buscarBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(abrirFormularioBusquedaAvanzadaBtn))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(imprimirBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(listarTodosBtn))
                    .addComponent(jSeparator1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(guardarBtn)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cancelarBtn))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(buscarTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buscarBtn)
                            .addComponent(abrirFormularioBusquedaAvanzadaBtn))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(imprimirBtn)
                            .addComponent(listarTodosBtn))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nuevaEnfermedadBtn)
                    .addComponent(cancelarBtn)
                    .addComponent(guardarBtn)
                    .addComponent(modificarBtn)
                    .addComponent(eliminarBtn))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void enfermedadesTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_enfermedadesTreeValueChanged
        gestorVista.setEnfermedadEnVista(GestorComponenteVista.getObjetoSeleccionado(enfermedadesTree));
    }//GEN-LAST:event_enfermedadesTreeValueChanged

    private void nuevaEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nuevaEnfermedadBtnActionPerformed
        limpiarPantalla();
        habilitarEdicion(true);
        gestorVista.registrarNuevaEntidad();
    }//GEN-LAST:event_nuevaEnfermedadBtnActionPerformed

    private void guardarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarBtnActionPerformed
        gestorEdicion.guardar();
    }//GEN-LAST:event_guardarBtnActionPerformed

    private void quitarSintomaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitarSintomaBtnActionPerformed
        if (!sintomasLst.isSelectionEmpty()){
            GestorComponenteVista.quitarDatoLista(sintomasLst, sintomasLst.getSelectedIndex());
        }
    }//GEN-LAST:event_quitarSintomaBtnActionPerformed

    private void tipoDeEnfermedadCmbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tipoDeEnfermedadCmbActionPerformed
        gestorVista.cargarDescripcionTipoEnfermedad(tipoDeEnfermedadCmb.getSelectedItem());
    }//GEN-LAST:event_tipoDeEnfermedadCmbActionPerformed

    private void addSintomaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSintomaBtnActionPerformed
        gestorVista.agregarSintomas(GestorComponenteVista.getObjetosEnLista(sintomasLst));
        selectorSintomasDlg.setVisible(true);
    }//GEN-LAST:event_addSintomaBtnActionPerformed

    private void declineBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_declineBtnActionPerformed
        selectorSintomasDlg.dispose();
    }//GEN-LAST:event_declineBtnActionPerformed

    private void acceptBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptBtnActionPerformed
        if (busquedaAvanzadaDlg.isVisible()) {
            GestorComponenteVista.agregarDatosLista(sintomasBusqLst, GestorComponenteVista.getObjetosEnLista(sintomasCkl));
        } else {
            GestorComponenteVista.agregarDatosLista(sintomasLst, GestorComponenteVista.getObjetosEnLista(sintomasCkl));            
        }
        selectorSintomasDlg.setVisible(false);
    }//GEN-LAST:event_acceptBtnActionPerformed

    private void cancelarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarBtnActionPerformed
        gestorEdicion.recargarEnVista();
        limpiarPantalla();
        habilitarEdicion(false);
    }//GEN-LAST:event_cancelarBtnActionPerformed

    private void modificarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modificarBtnActionPerformed
        if (!enfermedadesTree.isSelectionEmpty()) {
            limpiarPantalla();
            gestorVista.modificar(GestorComponenteVista.getObjetoSeleccionado(enfermedadesTree));
        }
    }//GEN-LAST:event_modificarBtnActionPerformed

    private void eliminarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eliminarBtnActionPerformed
        if (!enfermedadesTree.isSelectionEmpty() && gestorVista.mostrarDialogoDeEliminacion() == 0) {
            gestorVista.eliminar(GestorComponenteVista.getObjetoSeleccionado(enfermedadesTree));
            limpiarPantalla();
        }
    }//GEN-LAST:event_eliminarBtnActionPerformed

    private void buscarBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buscarBtnActionPerformed
        gestorVista.busquedaRapida("Nombre", buscarTxt.getText());
        GestorComponenteVista.expandirArbol(enfermedadesTree);
    }//GEN-LAST:event_buscarBtnActionPerformed

    private void crearSintomaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_crearSintomaBtnActionPerformed
        editorSintomasPnl.setSintomaGuardado(false);
        gestorVista.abrirFormularioSintoma(editorSintomasPnl);
    }//GEN-LAST:event_crearSintomaBtnActionPerformed

    private void cancelarEdicionSintomaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarEdicionSintomaBtnActionPerformed
        editorSintomasPnl.getNombreTxt().setText("");
        editorSintomasPnl.getDescripcionTxt().setText("");
        editorSintomasDlg.dispose();
    }//GEN-LAST:event_cancelarEdicionSintomaBtnActionPerformed

    private void guardarSintomaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarSintomaBtnActionPerformed
        editorSintomasPnl.getGestorVista().guardar();
        if (editorSintomasPnl.isSintomaGuardado()){
            GestorComponenteVista.agregarDatoLista(sintomasLst,
                   editorSintomasPnl.getGestorVista().getGestorModelo().getModelo());
            editorSintomasDlg.dispose();
        }
    }//GEN-LAST:event_guardarSintomaBtnActionPerformed

    private void guardarTipoEnfermedadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarTipoEnfermedadActionPerformed
        editorTipoEnfermedadPnl.getGestorVista().guardar();
        if (editorTipoEnfermedadPnl.isTipoGuardado()){
            GestorComponenteVista.agregarDatoCombo(tipoDeEnfermedadCmb,
                    editorTipoEnfermedadPnl.getGestorVista().getGestorModelo().getModelo());
            tipoDeEnfermedadCmb.setSelectedItem(editorTipoEnfermedadPnl.getGestorVista().getGestorModelo().getModelo());
        editorTiposEnfermedadDlg.dispose();
        }
    }//GEN-LAST:event_guardarTipoEnfermedadActionPerformed

    private void cancelarEdicionTipoEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarEdicionTipoEnfermedadBtnActionPerformed
        editorTipoEnfermedadPnl.getNombreTxt().setText("");
        editorTipoEnfermedadPnl.getDescripcionTxt().setText("");
        editorTipoEnfermedadPnl.getTipoCmb().setSelectedIndex(0);
        editorTiposEnfermedadDlg.dispose();
    }//GEN-LAST:event_cancelarEdicionTipoEnfermedadBtnActionPerformed

    private void crearTipoEnfermedadBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_crearTipoEnfermedadBtnActionPerformed
        editorTipoEnfermedadPnl.setTipoGuardado(false);
        gestorVista.abrirFormularioTipoEnfermedad(editorTipoEnfermedadPnl);
    }//GEN-LAST:event_crearTipoEnfermedadBtnActionPerformed

    private void imprimirBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imprimirBtnActionPerformed
        gestorVista.imprimir(GestorComponenteVista.getObjetosEnArbol(enfermedadesTree));
    }//GEN-LAST:event_imprimirBtnActionPerformed

    private void listarTodosBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listarTodosBtnActionPerformed
        gestorVista.listarTodos();
    }//GEN-LAST:event_listarTodosBtnActionPerformed

    private void addSintomaBtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSintomaBtn1ActionPerformed
        gestorVista.agregarSintomas(GestorComponenteVista.getObjetosEnLista(sintomasBusqLst));
        selectorSintomasDlg.setVisible(true);
    }//GEN-LAST:event_addSintomaBtn1ActionPerformed

    private void quitarSintomaBtn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitarSintomaBtn1ActionPerformed
        if (!sintomasBusqLst.isSelectionEmpty()) {
            GestorComponenteVista.quitarDatoLista(sintomasBusqLst, sintomasBusqLst.getSelectedIndex());
        }
    }//GEN-LAST:event_quitarSintomaBtn1ActionPerformed

    private void busquedaAvanzadaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busquedaAvanzadaBtnActionPerformed
        gestorVista.buscar();
        busquedaAvanzadaDlg.setVisible(false);
        GestorComponenteVista.expandirArbol(enfermedadesTree);
    }//GEN-LAST:event_busquedaAvanzadaBtnActionPerformed

    private void abrirFormularioBusquedaAvanzadaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abrirFormularioBusquedaAvanzadaBtnActionPerformed
        busquedaAvanzadaDlg.setVisible(true);
    }//GEN-LAST:event_abrirFormularioBusquedaAvanzadaBtnActionPerformed

    private void cancelarBusquedaBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarBusquedaBtnActionPerformed
        busquedaAvanzadaDlg.setVisible(false);
    }//GEN-LAST:event_cancelarBusquedaBtnActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton abrirFormularioBusquedaAvanzadaBtn;
    private javax.swing.JButton acceptBtn;
    private javax.swing.JButton addSintomaBtn;
    private javax.swing.JButton addSintomaBtn1;
    private javax.swing.JButton buscarBtn;
    private javax.swing.JTextField buscarTxt;
    private javax.swing.JButton busquedaAvanzadaBtn;
    private javax.swing.JDialog busquedaAvanzadaDlg;
    private javax.swing.JButton cancelarBtn;
    private javax.swing.JButton cancelarBusquedaBtn;
    private javax.swing.JButton cancelarEdicionSintomaBtn;
    private javax.swing.JButton cancelarEdicionTipoEnfermedadBtn;
    private javax.swing.JButton crearSintomaBtn;
    private javax.swing.JButton crearTipoEnfermedadBtn;
    private javax.swing.JButton declineBtn;
    private javax.swing.JTextArea descripcionDeEnfermedadTxt;
    private javax.swing.JTextArea descripcionDeTipoDeEnfermedadTxt;
    private javax.swing.JDialog editorSintomasDlg;
    private vista.patologias.SintomasPnl editorSintomasPnl;
    private vista.patologias.TipoEnfermedadPnl editorTipoEnfermedadPnl;
    private javax.swing.JDialog editorTiposEnfermedadDlg;
    private javax.swing.JButton eliminarBtn;
    private javax.swing.JTree enfermedadesTree;
    private javax.swing.JButton guardarBtn;
    private javax.swing.JButton guardarSintomaBtn;
    private javax.swing.JButton guardarTipoEnfermedad;
    private javax.swing.JButton imprimirBtn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JCheckBox ligadaAlSexoChk;
    private javax.swing.JButton listarTodosBtn;
    private javax.swing.JButton modificarBtn;
    private util.components.CamelCaseTextField nombreEnfermedadTxt;
    private javax.swing.JTextField nombreTxt;
    private javax.swing.JButton nuevaEnfermedadBtn;
    private org.japura.gui.CheckList parentescosTransmisoresCkl;
    private javax.swing.JButton quitarSintomaBtn;
    private javax.swing.JButton quitarSintomaBtn1;
    private javax.swing.JDialog selectorSintomasDlg;
    private javax.swing.JList sintomasBusqLst;
    private org.japura.gui.CheckList sintomasCkl;
    private javax.swing.JList sintomasLst;
    private javax.swing.JComboBox tipoDeEnfermedadCmb;
    private javax.swing.JComboBox tipoEnfermedadBusqCmb;
    // End of variables declaration//GEN-END:variables

    
    
}
class MyListCellRenderer extends DefaultListCellRenderer{
    @Override
    public Component getListCellRendererComponent(
        JList list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus)
    {
        setComponentOrientation(list.getComponentOrientation());

        Color bg = null;
        Color fg = null;

        JList.DropLocation dropLocation = list.getDropLocation();
        if (dropLocation != null
                && !dropLocation.isInsert()
                && dropLocation.getIndex() == index) {

            bg = UIManager.getColor("List.dropCellBackground");
            fg = UIManager.getColor("List.dropCellForeground");

            isSelected = true;
        }

        if (isSelected) {
            setBackground(bg == null ? list.getSelectionBackground() : bg);
            setForeground(fg == null ? list.getSelectionForeground() : fg);
        }
        else {
            setBackground(list.getBackground());
            setForeground(list.getForeground());
        }

        if (value instanceof Icon) {
            setIcon((Icon)value);
            setText("");
        }
        else {
            setIcon(null);
            setText((value == null) ? "" :" \u2022 "+ value.toString());
        }

        setEnabled(list.isEnabled());
        setFont(list.getFont());

        Border border = null;
        if (cellHasFocus) {
            if (isSelected) {
                border = UIManager.getBorder("List.focusSelectedCellHighlightBorder");
            }
            if (border == null) {
                border = UIManager.getBorder("List.focusCellHighlightBorder");
            }
        } else {
            border = getNoFocusBorder();
        }
        setBorder(border);

        return this;
    }


    private static Border getNoFocusBorder() {
        if (System.getSecurityManager() != null) {
            return new EmptyBorder(1, 1, 1, 1);
        } else {
            return UIManager.getBorder("List.noFocusBorder");
        }
    }
}